package srk.java.demo.draw2d2;

import org.eclipse.swt.widgets.Display;

public class DisplayTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Display display = new Display();
		display.beep();
		System.out.println("Start display");
		sleep(1500);
		display.beep();// this cause the system hardware to beep

		String property = System.getProperty("os.name");
		System.out.println(property);
		if ("Windows 7".equals(property)) {
			System.out.println("Inside windows 7");
			// System.out.println(display.getAppName());//the application name
			// is
		}
		// System.out.println(display.getAppName());//the application name is
		// above line not supported in Windows 7
		System.out.println(display.getCursorLocation());// returns the mouse
		// pointer location
		System.out.println("End display");
	}

	/**
	 * This method waits for the time specified in milli seconds
	 */
	private static void sleep(long i) {
		long time = System.currentTimeMillis();
		long elapsedTime = time + i;
		while (true) {
			if (System.currentTimeMillis() > elapsedTime)
				break;

		}
	}

}
